package com.le.basic.stringMatches;

import java.util.Arrays;

public class Code_04_Directionary {


    public static String process(String[] str) {
        Arrays.sort(str, (a, b) -> ((a + b).compareTo((b + a))));
        String res = "";
        for (int i = 0; i < str.length; i++) {
            res += str[i];
        }
        return res;
    }

    public static void main(String[] args) {
        String[] str1 = {"jibw", "ji", "jp", "bw", "jib"};
        System.out.println(process(str1));
        String[] str2 = {"ac", "aa"};
        System.out.println(process(str2));
    }

}
